#include <functional>
#include <string>
#include <vector>
#include <iostream>
#include <ctime>
#include <unistd.h>
#include <sys/wait.h>

using task_t = std::function<void()>;

class TaskManger
{
public:
    // 创建所有任务
    TaskManger()
    {
        srand(time(nullptr));
        taskmanger.push_back([]()
                             { std::cout << "访问数据库的任务" << std::endl; });
        taskmanger.push_back([]()
                             { std::cout << "加密任务" << std::endl; });
        taskmanger.push_back([]()
                             { std::cout << "数据持久化任务" << std::endl; });
        taskmanger.push_back([]()
                             { std::cout << "访问磁盘任务" << std::endl; });
        taskmanger.push_back([]()
                             { std::cout << "删除文件任务" << std::endl; });
    }
    void Task_select(long long k)
    {
        taskmanger[k % 5]();
    }

private:
    std::vector<task_t> taskmanger;
};

TaskManger task;